package com.octopus.core.downloader.proxy;

import lombok.Data;
import lombok.NonNull;

/**
 * HTTP代理服务器配置
 *
 * @author yang_shoulai@hoperun.com
 * @date 2019/08/03
 */
@Data
public class Proxy {

  /** 主机 */
  private String host;

  /** 端口 */
  private int port;

  /** 密码 */
  private String password;

  /** 用户名 */
  private String username;

  public Proxy() {}

  public Proxy(@NonNull String host, int port) {
    this.host = host;
    this.port = port;
  }

  public Proxy(@NonNull String host, int port, String username, String password) {
    this.host = host;
    this.port = port;
    this.username = username;
    this.password = password;
  }

  @Override
  public String toString() {
    return String.format("Proxy[host = %s, port = %s]", host, port);
  }

  public static Proxy of(@NonNull String host, int port) {
    return new Proxy(host, port);
  }

  public static Proxy of(@NonNull String host, int port, String username, String password) {
    return new Proxy(host, port, username, password);
  }
}
